home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / doom / ldhe-src.0 / ldhe-src / dehacked / source / x11_graphics.h < prev    next >
C/C++ Source or Header  |  1995-05-09  |  3KB  |  88 lines

  1.  
  2. #ifndef X11_Graphics_h
  3. #define X11_Graphics_h
  4.  
  5. /**********************************************************************/
  6. /*                                                                    */
  7. /*  Much of the X11 color code has been taken from dosemu0.56         */
  8. /*                                                                    */
  9. /*      -Thanks! :)                                                   */
  10. /*                                                                    */
  11. /**********************************************************************/
  12.  
  13. #include <X11/X.h>
  14. #include <X11/Xlib.h>
  15. #include <X11/Xutil.h>
  16. #include <X11/keysym.h>
  17.  
  18. #define PROGNAME    "xdhe"
  19.  
  20. #define X11_BLACK       0
  21. #define X11_BLUE        1
  22. #define X11_GREEN       2
  23. #define X11_CYAN        3
  24. #define X11_RED         4
  25. #define X11_MAGENTA     5
  26. #define X11_YELLOW      6
  27. #define X11_WHITE       7
  28.  
  29. #define NUM_COLORS    256    /* Pseudo-color display with 256 colors */
  30.  
  31. #define FONT_WIDTH    8
  32. #define FONT_HEIGHT    8
  33. #define DISPLAY_WIDTH    (FONT_WIDTH*80)
  34. #define DISPLAY_HEIGHT    (FONT_HEIGHT*50)
  35.  
  36. // The X11 graphics module:
  37.  
  38. class X11_Graphics : public TTY_Graphics {
  39.  
  40. public:
  41.     X11_Graphics();
  42.     virtual ~X11_Graphics();
  43.  
  44.     virtual int ibm_charset(void);
  45.     virtual void flush(void);
  46.     virtual void setcursor(int on);
  47.     virtual void set_default_colors(void);
  48.     virtual void set_colors(int bright, int fg, int bg);
  49.     virtual void clear(void);
  50.     virtual void clrbox(int x, int y, int width, int height);
  51.     virtual void clreol(void);
  52.     virtual void gotoxy(int x, int y);
  53.     virtual void putch(int ch);
  54.     virtual int has_graphics(void);
  55.     virtual void set_grmode(int newmode);
  56.     virtual void set_colormap(struct color colormap[256]);
  57.     virtual void clr_grscreen(void);
  58.     virtual void put_graphics_txt(int x, int y, char *string, 
  59.                             unsigned char color);
  60.     virtual void drawpoint(int x, int y, unsigned char color);
  61.  
  62. protected:
  63.     virtual int OpenMainWindow(int mode);
  64.     virtual void Map_Color(Colormap colormap, XColor *xcol);
  65.     virtual void expand_8x8font(char smallfont[], char bigfont[]);
  66.  
  67.     Display *display;        // The X11 display connection
  68.     Window   MainWin;        // Our window on the display
  69.     unsigned long Event_mask;    // The events we wait for
  70.     XImage  *xwindow;        // Our in-core image of our window
  71.     Colormap vga_colormap;        // The 16 color VGA colormap
  72.     Colormap vis_colormap;        // The 256 color VGA colormap
  73.     GC            gc;        // Our current graphics context
  74.     unsigned long vga_colors[16];    // The standard IBM colors (pixels)
  75.     unsigned long fg, bg;        // Current colors 
  76.     int  bright;            // Current brightness
  77.     XImage  *pc8x8[256];        // The 8x8 bitmap font
  78.     struct {
  79.         int x, y;
  80.         } cursor;        // The current cursor location 
  81.     XImage  *vga_cursor;        // The 8x8 cursor image
  82.     XImage  *undercursor;        // The image behind the cursor
  83.     int      cursor_on;        // Do we draw the cursor?
  84.     GC     cursor_gc;        // An XOR GC for the cursor
  85. };
  86.  
  87. #endif
  88.